package com.kclmedu.ribbon.controller;

import com.kclmedu.ribbon.service.IHelloService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/*************************
 *@ClassName HelloRibbonController
 *@Description 使用 Ribbon + RestTemplate 来实现对目标服务的调用[支持集群]
 *@Author yejf
 *@Date 2019-12-01 22:21
 *@Version 1.0
 */
@RestController
public class HelloRibbonController {

    @Autowired
    private IHelloService helloService;

    @RequestMapping("/hello")
    public String helloRibbon(@RequestParam String name) {
        System.out.println("--- 在 RibbonController中....");
        //直接调用 业务层的方法
        return helloService.hiService(name);
    }
}
